package com.rd.student.dashuju.sunwenzhuo.Test3;

public class FourThread {

    static int i = 10;

    public static void main(String[] args) throws InterruptedException {


        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                i++;
                System.out.println(Thread.currentThread().getName() + " " + i);
            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                i++;
                System.out.println(Thread.currentThread().getName() + " " + i);
            }
        });

        Thread t3 = new Thread(new Runnable() {
            @Override
            public void run() {
                i--;
                System.out.println(Thread.currentThread().getName() + " " + i);
            }
        });
        Thread t4 = new Thread(new Runnable() {
            @Override
            public void run() {
                i--;
                System.out.println(Thread.currentThread().getName() + " " + i);
            }
        });

        t1.start();
        t1.join();
        t2.start();
        t2.join();
        t3.start();
        t3.join();
        t4.start();

    }


}




